/*  Replication files for

Plutzer, Eric, Mark McCaffrey, A. Lee Hannah, Joshua Rosenau, Minda Berbeco,
and Ann H. Reid. 2016. "Climate confusion among U.S. teachers." Science

Replication Files

Created by Lee Hannah

1.28.2016

Email: plutzer@psu.edu; lee.hannah@wright.edu 

*/

clear 
**
** Read in data-- need to set path file name

*cd "PATH FILE NAME HERE"

use "Climate_Confusion_Replication_February2016_Release.dta"


/*

1. We collected data from 1500 public middle- 
and high school science teachers from all fifty 
U.S. states, representative of the population of 
science teachers in terms of school size, student 
socioeconomic status, and community economic and 
political characteristics.
*/

* tab response 

/*

   response |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |      1,500      100.00      100.00
------------+-----------------------------------
      Total |      1,500      100.00


*/

* tab state

/*
               state |      Freq.     Percent        Cum.
---------------------+-----------------------------------
              ALASKA |          8        0.53        0.53
             ARIZONA |         22        1.47        2.00
            ARKANSAS |         12        0.80        2.80
             AlABAMA |         18        1.20        4.00
          CALIFORNIA |        113        7.53       11.53
            COLORADO |         26        1.73       13.27
         CONNECTICUT |         14        0.93       14.20
            DELAWARE |          9        0.60       14.80
             FLORIDA |         64        4.27       19.07
             GEORGIA |         44        2.93       22.00
              HAWAII |          7        0.47       22.47
               IDAHO |         10        0.67       23.13
            ILLINOIS |         71        4.73       27.87
             INDIANA |         32        2.13       30.00
                IOWA |         14        0.93       30.93
              KANSAS |         23        1.53       32.47
            KENTUCKY |         18        1.20       33.67
           LOUISIANA |         14        0.93       34.60
               MAINE |          8        0.53       35.13
            MARYLAND |         27        1.80       36.93
       MASSACHUSETTS |         38        2.53       39.47
            MICHIGAN |         37        2.47       41.93
           MINNESOTA |         34        2.27       44.20
         MISSISSIPPI |         11        0.73       44.93
            MISSOURI |         35        2.33       47.27
             MONTANA |          8        0.53       47.80
            NEBRASKA |         12        0.80       48.60
              NEVADA |         12        0.80       49.40
       NEW HAMPSHIRE |          7        0.47       49.87
          NEW JERSEY |         49        3.27       53.13
          NEW MEXICO |          9        0.60       53.73
            NEW YORK |         96        6.40       60.13
      NORTH CAROLINA |         41        2.73       62.87
        NORTH DAKOTA |          8        0.53       63.40
                OHIO |         65        4.33       67.73
            OKLAHOMA |         19        1.27       69.00
              OREGON |         19        1.27       70.27
        PENNSYLVANIA |        100        6.67       76.93
        RHODE ISLAND |          7        0.47       77.40
      SOUTH CAROLINA |         31        2.07       79.47
        SOUTH DAKOTA |          7        0.47       79.93
           TENNESSEE |         36        2.40       82.33
               TEXAS |        115        7.67       90.00
                UTAH |         12        0.80       90.80
             VERMONT |          7        0.47       91.27
            VIRGINIA |         40        2.67       93.93
          WASHINGTON |         38        2.53       96.47
       WEST VIRGINIA |         13        0.87       97.33
           WISCONSIN |         34        2.27       99.60
             WYOMING |          6        0.40      100.00
---------------------+-----------------------------------
               Total |      1,500      100.00

*/


***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************


/*
2. Three in four science teachers allocate at least an 
hour to discussing recent global warming in their formal 
lesson plans, including 70% of middle-school science teachers 
and 87% of high-school biology teachers (table S7).

*/


** Constructing number of hours taught variable.
gen q1_num_globalwarm = q1_globalwarm


**** MULTIPLE PUNCH RESPONDENTS INDICATED ON VERIFICATION LOGS
** SRCID=="12644" scored 1 and 4 (none and 6-10) but answered extensively on Q3
replace q1_globalwarm = 4 if SRCID=="12644" 


foreach var of varlist q1_num_globalwarm*{
recode `var' 1 = 0
recode `var' 2 = 1.5
recode `var' 3 = 4
recode `var' 4 = 8
recode `var' 5 = 13
recode `var' 6 = 18
recode `var' 7 = 25
}
replace q1_num_globalwarm = 4 if q1_globalwarm == 3


** Mean for Hours Taught
tabstat q1_num_globalwarm [aw = anal_wt] if q1_globalwarm!= 1, by(subject)

/*
      subject |      mean
--------------+----------
      biology |  4.156283
earth science |  6.030772
      physics |  4.059772
    chemistry |  3.486295
middle school |  4.425481
--------------+----------
        Total |  4.348801
-------------------------
*/



** Three in four science teachers

tab q1_num_globalwarm
/*
q1_num_glob |
     alwarm |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |        384       26.02       26.02
        1.5 |        542       36.72       62.74
          4 |        315       21.34       84.08
          8 |        113        7.66       91.73
         13 |         63        4.27       96.00
         18 |         32        2.17       98.17
         25 |         27        1.83      100.00
------------+-----------------------------------
      Total |      1,476      100.00

*/

** 70% of middle-school science teachers and 87% of high school biology teachers

tab subject q1_globalwarm [aw=anal_wt], row

/*
     1 bio; 2 |
        earth |
   science; 3 |
   physics; 4 | ...please indicate how many class hours (40-50 minutes) you typically spend
     chem ; 5 |                                     on..
middle school | not cover  1-2 hours  3-5 hours  6-10 hour  11-15 hou  16-20 hou  20 hours  |     Total
--------------+-----------------------------------------------------------------------------+----------
      biology |  55.67577 192.595638   104.3387  31.058844 17.8121523 8.33857018  6.5032093 | 416.32288 
              |     13.37      46.26      25.06       7.46       4.28       2.00       1.56 |    100.00 
--------------+-----------------------------------------------------------------------------+----------
earth science | 4.2691699   30.63391  29.042686  14.115043  8.9809388   3.496883  3.4547202 |  93.99335 
              |      4.54      32.59      30.90      15.02       9.55       3.72       3.68 |    100.00 
--------------+-----------------------------------------------------------------------------+----------
      physics | 125.78362  77.701209  20.304012  10.064111   5.891952          0  5.1470666 | 244.89197 
              |     51.36      31.73       8.29       4.11       2.41       0.00       2.10 |    100.00 
--------------+-----------------------------------------------------------------------------+----------
    chemistry | 77.250994   56.43086  20.134202  6.1799605  5.3818076          0  1.0528082 | 166.43063 
              |     46.42      33.91      12.10       3.71       3.23       0.00       0.63 |    100.00 
--------------+-----------------------------------------------------------------------------+----------
middle school | 164.93802  194.84936  118.70006  37.869305  15.490377  15.838584  6.6754631 | 554.36117 
              |     29.75      35.15      21.41       6.83       2.79       2.86       1.20 |    100.00 
--------------+-----------------------------------------------------------------------------+----------
        Total | 427.91757  552.21098 292.519655  99.287264  53.557228  27.674037  22.833268 |     1,476 
              |     28.99      37.41      19.82       6.73       3.63       1.87       1.55 |    100.00 
*/


***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************


/*

3. Most teachers reported covering the greenhouse effect (66%), the carbon cycle (63%), 
and four or more observable consequences, such as sea-level rise. or changes in seasonal patterns, 
such as the flowering of plants and animal migrations. 

*/


sum q3* [aweight = anal_wt]

tab q3_greenhouse_lesson  [aweight = anal_wt], missing 

/*
 did any of |
 these come |
      up in |
class...gre |
    enhouse |
    effect: |
 covered as |
 part of my |
        les |      Freq.     Percent        Cum.
------------+-----------------------------------
        yes | 992.460112       66.16       66.16
         no | 444.429024       29.63       95.79
          . | 63.1108636        4.21      100.00
------------+-----------------------------------
      Total |      1,500      100.00

*/


tab q3_carboncyc_lesson [aweight = anal_wt], missing

/*
 did any of |
 these come |
      up in |
class...car |
 bon cycle: |
 covered as |
 part of my |
   lesson p |      Freq.     Percent        Cum.
------------+-----------------------------------
        yes | 945.732034       63.05       63.05
         no | 517.159435       34.48       97.53
          . | 37.1085311        2.47      100.00
------------+-----------------------------------
      Total |      1,500      100.00

*/

tab q3_chsealevel_lesson [aweight = anal_wt], missing

/*

 did any of |
 these come |
      up in |
class...sea |
      level |
    change: |
 covered as |
 part of my |
       less |      Freq.     Percent        Cum.
------------+-----------------------------------
        yes |  753.27638       50.22       50.22
         no | 652.870001       43.52       93.74
          . | 93.8536188        6.26      100.00
------------+-----------------------------------
      Total |      1,500      100.00

*/


tab q3_plantanimal_lesson [aweight = anal_wt], missing

/*
 did any of |
 these come |
      up in |
class...sea |
      sonal |
plant/anima |
     l life |
     (i.e., |
 plant flow |      Freq.     Percent        Cum.
------------+-----------------------------------
        yes | 799.122457       53.27       53.27
         no |  644.24309       42.95       96.22
          . | 56.6344525        3.78      100.00
------------+-----------------------------------
      Total |      1,500      100.00

*/


***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************


/*

4. Teachers also discuss responses to climate change and careers addressing the challenges it poses.

*/


sum q5* [aweight = anal_wt]
*1 = Yes, 2 = No
* ERIC - We are vague on this statement. Perhaps rescale, tally (count for yes answers on each of these,
* then report a sum of total number of alternatives they discuss.  

/*

    Variable |     Obs      Weight        Mean   Std. Dev.       Min        Max
-------------+-----------------------------------------------------------------
q5_policys~s |    1469   1466.8103    1.784288   .4114557          1          2
q5_technol~y |    1471  1469.03485    1.218303   .4132344          1          2
q5_geoengi~g |    1468  1463.31579    1.618862    .485832          1          2
q5_student~s |    1467  1464.55226    1.225126   .4178075          1          2
   q5_career |    1467  1465.32789    1.414661   .4928314          1          2
*/


***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************


/*
5. Although most students will hear something about climate change in a science class, 
the median teacher devotes only 1 to 2 hours to the topic 
Table S7
*/

tab q1_num_globalwarm [aweight = anal_wt], missing

/*

q1_num_glob |
     alwarm |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 | 428.577946       28.57       28.57
        1.5 | 553.063172       36.87       65.44
          4 | 294.811436       19.65       85.10
          8 |  97.600134        6.51       91.60
         13 | 53.6398795        3.58       95.18
         18 | 27.7167445        1.85       97.03
         25 | 22.8685046        1.52       98.55
          . | 21.7221836        1.45      100.00
------------+-----------------------------------
      Total |      1,500      100.00


*/


***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************


/*
6. Notably, 30% of teachers emphasize that recent global warming �is 
likely due to natural causes,�
*/

tab q4_naturalcauses [aw=anal_wt], missing

/*
 when i do teach |
    about climate |
       change...i |
   emphasize that |
  many scientists |
         believe  |      Freq.     Percent        Cum.
------------------+-----------------------------------
   strongly agree | 67.3398072        4.49        4.49
            agree |  392.52073       26.17       30.66
              2.5 | 2.44036904        0.16       30.82
         disagree | 447.739402       29.85       60.67
strongly disagree | 202.436312       13.50       74.17
   not applicable | 370.118423       24.67       98.84
                . | 17.4049564        1.16      100.00
------------------+-----------------------------------
            Total |      1,500      100.00
*/


***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************


/*
7. ... and 12% do not emphasize human causes (half of whom do not emphasize any ex-
planation and thereby avoid the topic altogether).
*/

tab q4_sciconsensus [aw=anal_wt], missing

/*
  when i do teach |
    about climate |
       change...i |
    emphasize the |
       scientific |
   consensus that |      Freq.     Percent        Cum.
------------------+-----------------------------------
   strongly agree | 436.193876       29.08       29.08
            agree |  544.84315       36.32       65.40
              2.5 | .895647491        0.06       65.46
         disagree | 129.849724        8.66       74.12
strongly disagree | 44.8527996        2.99       77.11
   not applicable | 331.343574       22.09       99.20
                . | 12.0212292        0.80      100.00
------------------+-----------------------------------
            Total |      1,500      100.00

*/


***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************


/*
8. Of teachers who teach climate change, 31% report sending explicitly 
contradictory messages, emphasizing both the scientific consensus that 
recent global warming is due to human activity and that many scientists 
believe recent increases in temperature are due to natural causes*/
** DESCRIPTIVES FOR THESE TWO ANSWERS FOLLOWED BY A TAB THAT SHOWS WHICH TEACH BOTH AT THE SAME TIME.

tab q4_naturalcauses [aw=anal_wt], missing
/*


  when i do teach |
    about climate |
       change...i |
   emphasize that |
  many scientists |
         believe  |      Freq.     Percent        Cum.
------------------+-----------------------------------
   strongly agree | 67.3367553        4.49        4.49
            agree | 392.517056       26.17       30.66
              2.5 | 2.44119374        0.16       30.82
         disagree |  447.68755       29.85       60.67
strongly disagree | 202.418032       13.49       74.16
   not applicable |370.1885747       24.68       98.84
                . |17.41083823        1.16      100.00
------------------+-----------------------------------
            Total |      1,500      100.00


*/

tab q4_sciconsensus [aw=anal_wt], missing
/*


  when i do teach |
    about climate |
       change...i |
    emphasize the |
       scientific |
   consensus that |      Freq.     Percent        Cum.
------------------+-----------------------------------
   strongly agree |436.2069456       29.08       29.08
            agree | 544.828084       36.32       65.40
              2.5 | .895950165        0.06       65.46
         disagree | 129.820812        8.65       74.12
strongly disagree | 44.8335455        2.99       77.11
   not applicable | 331.389372       22.09       99.20
                . | 12.0252917        0.80      100.00
------------------+-----------------------------------
            Total |      1,500      100.00


*/

** We remove 'not applicable' answers from the analysis

tab q4_naturalcauses q4_sciconsensus if q4_naturalcauses != 5 & q4_sciconsensus != 5  [aw=anal_wt], cell
 
/*

 when i do teach |
    about climate |
       change...i |
   emphasize that | when i do teach about climate change...i emphasize the
  many scientists |               scientific consensus that
         believe  | strongly       agree        2.5   disagree  strongly  |     Total
------------------+-------------------------------------------------------+----------
   strongly agree | 33.899617   3.008877          0  14.582883  14.498685 | 65.990063 
                  |      2.98       0.26       0.00       1.28       1.27 |      5.80 
------------------+-------------------------------------------------------+----------
            agree | 62.310744 255.452875          0  63.994354   18.72988 | 400.48785 
                  |      5.48      22.45       0.00       5.62       1.65 |     35.19 
------------------+-------------------------------------------------------+----------
              2.5 |         0          0  .92831739  1.6010673          0 | 2.5293846 
                  |      0.00       0.00       0.08       0.14       0.00 |      0.22 
------------------+-------------------------------------------------------+----------
         disagree | 170.27306  236.97516          0  47.321362   6.307596 | 460.87718 
                  |     14.96      20.82       0.00       4.16       0.55 |     40.50 
------------------+-------------------------------------------------------+----------
strongly disagree | 165.64529  40.040131          0          0  2.4300963 | 208.11552 
                  |     14.56       3.52       0.00       0.00       0.21 |     18.29 
------------------+-------------------------------------------------------+----------
            Total | 432.12872  535.47704  .92831739  127.49967  41.966257 |     1,138 
                  |     37.97      47.05       0.08      11.20       3.69 |    100.00 
*/



***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************


/*
9. Only 4.4% of teachers reported such pressure (6.1% reported pressure 
to teach it, mostly from fellow teachers). 

ERIC - I THINK WE NEED TO CHANGE THE NUMBERS IN THE SCIENCE DRAFT TO 4.5% AND 5.9% - We might need to make
a note about errata here. 

I looked at this two ways. First, I created varialbes to sum the total number of times
they selected any of the pressure answers (We get 6.1 if we take out missing)

Next, I looked at how many selected "I have received/not received pressure" I cannot replicate
4.4 and 6.1 although we are very close.  
*/

gen q9_sumpressure_teach =  q9_teachgw_schooladmin +  q9_teachgw_local + ///
q9_teachgw_parents +  q9_teachgw_schoolboard  + q9_teachgw_teachers +  q9_teachgw_other 

tab q9_sumpressure_teach [aw=anal_wt] 
/*

q9_sumpress |
  ure_teach |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 | 1,390.3813       94.07       94.07
          1 | 72.1365012        4.88       98.95
          2 | 11.0077586        0.74       99.70
          3 | 1.10384808        0.07       99.77
          4 | 3.37061918        0.23      100.00
------------+-----------------------------------
      Total |      1,478      100.00

*/


tab q9_sumpressure_teach [aw=anal_wt], missing
/*
q9_sumpress |
  ure_teach |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 | 1,387.7724       92.52       92.52
          1 |72.00114397        4.80       97.32
          2 | 10.9871036        0.73       98.05
          3 |1.101776816        0.07       98.12
          4 | 3.36429454        0.22       98.35
          . | 24.7733262        1.65      100.00
------------+-----------------------------------
      Total |      1,500      100.00



*/

gen q9_sumpressure_noteach = q9_noteachgw_schooladmin + q9_noteachgw_local + ///
q9_noteachgw_parents + q9_noteachgw_schoolboard + q9_noteachgw_teachers + q9_noteachgw_other 


tab q9_sumpressure_noteach [aw=anal_wt]
/*
q9_sumpress |
ure_noteach |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 | 1,411.1316       95.48       95.48
          1 | 50.6552936        3.43       98.90
          2 | 8.89727069        0.60       99.51
          3 |  2.0267872        0.14       99.64
          4 | 2.01466025        0.14       99.78
          5 | 2.90511638        0.20       99.98
          6 | .369279213        0.02      100.00
------------+-----------------------------------
      Total |      1,478      100.00


*/

tab q9_sumpressure_noteach [aw=anal_wt], missing

/*

q9_sumpress |
ure_noteach |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 | 1,408.4837       93.90       93.90
          1 | 50.5602437        3.37       97.27
          2 |8.880575812        0.59       97.86
          3 | 2.02298412        0.13       98.00
          4 |2.010879927        0.13       98.13
          5 | 2.89966521        0.19       98.32
          6 | .368586296        0.02       98.35
          . | 24.7733262        1.65      100.00
------------+-----------------------------------
      Total |      1,500      100.00

*/

tab q9_noteachgw_none q9_teachgw_none [aw=anal_wt], cell

/*
THIS GETS 4.5 (SAME AS DRAFT) AND 5.9 (0.2 LESS THAN DRAFT)
I WOULD GO WITH THIS ONE
      i have |
    received |
 pressure to |
   not teach |    i have received
 about human |   pressure to teach
   causes of | about human causes of
      global | global warming from:
     warming |          no 
       from: |         0   selected |     Total
-------------+----------------------+----------
           0 | 25.200035  41.668372 | 66.868407 
             |      1.71       2.82 |      4.52 
-------------+----------------------+----------
    selected | 62.418692 1,348.7129 | 1,411.132 
             |      4.22      91.25 |     95.48 
-------------+----------------------+----------
       Total | 87.618727  1,390.381 |     1,478 
             |      5.93      94.07 |    100.00 

*/

tab q9_noteachgw_none q9_teachgw_none [aw=anal_wt], missing cell

/*
THIS GETS 4.5 (0.1 HIGHER) AND 5.8 (0.3 LESS)
      i have |
    received |
 pressure to |
   not teach |
 about human |
   causes of |   i have received pressure to
      global |   teach about human causes of
     warming |     global warming from: no 
       from: |         0   selected          . |     Total
-------------+---------------------------------+----------
           0 | 25.152749  41.590186          0 | 66.742935 
             |      1.68       2.77       0.00 |      4.45 
-------------+---------------------------------+----------
    selected |  62.30157  1,346.182          0 | 1,408.484 
             |      4.15      89.75       0.00 |     93.90 
-------------+---------------------------------+----------
           . |         0          0  24.773326 | 24.773326 
             |      0.00       0.00       1.65 |      1.65 
-------------+---------------------------------+----------
       Total | 87.454319  1,387.772  24.773326 |     1,500 
             |      5.83      92.52       1.65 |    100.00 

*/


***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************


/*
10. [Pressure] mostly from fellow teachers
*/
sum q9_teachgw_teachers 
/*
    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
q9_teachg~rs |      1478    .0317997    .1755259          0          1
*/

* Compare to other values

sum q9* [aw = anal_wt]


***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************


/*
11. Given the relative novelty of the topic in classrooms, 
instructional materials, and pre-service training, this would 
not be surprising, and nearly 50% said that they would prioritize 
one or more unrelated topics (e.g., pesticides, ozone layer, or 
impacts of rocket launches).

ERIC - NEARLY 50% SAID THAT THEY WOULD GIVE HIGH PRIORITY TO ONE OR MORE TOPICS OR 

OVER 85% SAID THAT THEY WOULD GIVE PRIORITY TO ONE OR MORE TOPICS

*/


tab q8_pesticides [aw = anal_wt]

tab q8_aerosol [aw = anal_wt]

tab q8_ozone [aw = anal_wt]

tab q8_rockets [aw = anal_wt]

/*
** Creating variables for foils
Indicates whether respondent selected 
'a medium priority' or a 'high priority'
*/
gen q8_foil_pest = 0
replace q8_foil_pest = 1 if q8_pesticides == 1
replace q8_foil_pest = 1 if q8_pesticides == 2

gen q8_foil_aero = 0
replace q8_foil_aero = 1 if q8_aerosol == 1
replace q8_foil_aero = 1 if q8_aerosol == 2

gen q8_foil_ozone = 0
replace q8_foil_ozone= 1 if q8_ozone == 1
replace q8_foil_ozone = 1 if q8_ozone == 2

gen q8_foil_rockets = 0
replace q8_foil_rockets= 1 if q8_rockets == 1
replace q8_foil_rockets = 1 if q8_rockets == 2

gen q8_foil = q8_foil_pest + q8_foil_aero + q8_foil_ozone + q8_foil_rockets

tab q8_foil [aw = anal_wt]

/*

    q8_foil |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 | 208.110237       13.87       13.87
          1 | 176.468415       11.76       25.64
          2 | 308.651026       20.58       46.22
          3 | 465.810744       31.05       77.27
          4 | 340.959577       22.73      100.00
------------+-----------------------------------
      Total |      1,500      100.00

*/


/*

** Highest priority
** Creating variables for foils
Indicates whether respondent selected 
'a high priority' 
*/
gen q8_hpfoil_pest = 0
replace q8_hpfoil_pest = 1 if q8_pesticides == 1

gen q8_hpfoil_aero = 0
replace q8_hpfoil_aero = 1 if q8_aerosol == 1

gen q8_hpfoil_ozone = 0
replace q8_hpfoil_ozone= 1 if q8_ozone == 1

gen q8_hpfoil_rockets = 0
replace q8_hpfoil_rockets= 1 if q8_rockets == 1

gen q8_hpfoil = q8_hpfoil_pest + q8_hpfoil_aero + q8_hpfoil_ozone + q8_hpfoil_rockets

tab q8_hpfoil [aw = anal_wt]

/*
  q8_hpfoil |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |  767.67267       51.18       51.18
          1 | 416.415955       27.76       78.94
          2 |  189.16147       12.61       91.55
          3 | 101.764854        6.78       98.33
          4 | 24.9850516        1.67      100.00
------------+-----------------------------------
      Total |      1,500      100.00

*/


***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************


/*
12. Yet, when asked �what proportion of climate scien-tists think that global warming 
is caused mostly by human activities?� only 30% of middle-school and 45% of high-school 
science teachers selected the correct op-tion of �81 to 100%.� 
*/

tab q18_humanpct [aw = anal_wt] if hssample == 0
/*

 to the best |
     of your |
  knowledge, |
        what |
  proportion |
  of climate |
  scientists |
 think that  |      Freq.     Percent        Cum.
-------------+-----------------------------------
     0 - 20% | 10.7816201        1.95        1.95
   21% - 40% | 39.9643038        7.21        9.16
   41% - 60% | 69.3837429       12.52       21.68
   61% - 80% | 128.423512       23.18       44.87
  81% - 100% | 166.738954       30.10       74.96
i don't know | 138.707866       25.04      100.00
-------------+-----------------------------------
       Total |        554      100.00
*/

tab q18_humanpct [aw = anal_wt] if hssample == 1

/*

 to the best |
     of your |
  knowledge, |
        what |
  proportion |
  of climate |
  scientists |
 think that  |      Freq.     Percent        Cum.
-------------+-----------------------------------
     0 - 20% | 14.9291843        1.63        1.63
   21% - 40% |52.68597606        5.76        7.39
   41% - 60% |107.6613328       11.77       19.16
   61% - 80% | 159.933626       17.48       36.63
  81% - 100% | 409.392656       44.74       81.38
i don't know | 170.397226       18.62      100.00
-------------+-----------------------------------
       Total |        915      100.00

*/


***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************


/*
13. Although only 2% of teachers personally denied that recent global 
warming is happening, almost one-sixth (15%) believe that it is mostly driven by natural 
causes, and another sixth thought that human and natural causes are equally important. 
*/

tab q16_gwcauses [aw = anal_wt] 

/*
which of the following comes closest to |
                             your view? |      Freq.     Percent        Cum.
----------------------------------------+-----------------------------------
global warming is caused mostly by huma | 970.245127       67.71       67.71
                                    1.5 | 164.601194       11.49       79.19
global warming is caused mostly by natu | 228.985965       15.98       95.17
        global warming is not happening |32.13663263        2.24       97.42
                        other (specify) | .294181497        0.02       97.44
                                      5 | 36.7369005        2.56      100.00
----------------------------------------+-----------------------------------
                                  Total |      1,433      100.00

*/


***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************


/*
14. Indeed, teachers� assessment of the scientific consensus is intertwined 
with their personal conclusions about global warming and its causes (see the chart) (Fig. 2).

*/

tab q16_gwcauses q18_humanpct [aw = anal_wt], cell

/*
         which of the |     to the best of your knowledge, what proportion of climate
      following comes |                      scientists think that 
closest to your view? |   0 - 20%  21% - 40%  41% - 60%  61% - 80%  81% - 100  i don't k |     Total
----------------------+------------------------------------------------------------------+----------
global warming is cau | 5.1342408  26.129556  88.552739 197.669497  504.69567 147.152939 | 969.33464 
                      |      0.36       1.83       6.19      13.81      35.27      10.28 |     67.74 
----------------------+------------------------------------------------------------------+----------
                  1.5 | 3.2908388  19.659199  22.202069  38.360533  24.615978  56.372513 | 164.50113 
                      |      0.23       1.37       1.55       2.68       1.72       3.94 |     11.50 
----------------------+------------------------------------------------------------------+----------
global warming is cau | 14.086361  35.450003  54.230369  35.708006  17.455117  71.108708 | 228.03856 
                      |      0.98       2.48       3.79       2.50       1.22       4.97 |     15.94 
----------------------+------------------------------------------------------------------+----------
global warming is not |  2.114757  5.6298979  3.7697735  8.5439791          0  12.058689 | 32.117097 
                      |      0.15       0.39       0.26       0.60       0.00       0.84 |      2.24 
----------------------+------------------------------------------------------------------+----------
      other (specify) |         0          0          0          0          0  .29400266 | .29400266 
                      |      0.00       0.00       0.00       0.00       0.00       0.02 |      0.02 
----------------------+------------------------------------------------------------------+----------
                    5 |         0  5.9041756  2.8177319  1.6426812  19.189217  7.1607621 | 36.714568 
                      |      0.00       0.41       0.20       0.11       1.34       0.50 |      2.57 
----------------------+------------------------------------------------------------------+----------
                Total | 24.626198  92.772831  171.57268   281.9247  565.95598  294.14761 |     1,431 
                      |      1.72       6.48      11.99      19.70      39.55      20.56 |    100.00 

*/


***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************


/*
15. Fewer than half of the teachers report any formal instruction in climate science in college. 

*/

tab q21_sectionclimate_college q21_courseclimate_college [aw=anal_wt], cell

/*
   courses |
      that |
   devoted |
    one or |
more class |
  sessions |
to climate |
   change: |   courses entirely focused on climate change: total
     total |             number of semester/quarter len
   number  |         0          1          2          3          4 |     Total
-----------+-------------------------------------------------------+----------
         0 | 819.44416  5.2500286  5.1122137  1.1005233  1.1750006 | 832.08192 
           |     57.14       0.37       0.36       0.08       0.08 |     58.03 
-----------+-------------------------------------------------------+----------
         1 |247.406014 37.3444999  1.3698455          0          0 | 286.12036 
           |     17.25       2.60       0.10       0.00       0.00 |     19.95 
-----------+-------------------------------------------------------+----------
         2 | 133.27417  31.700395  18.470296          0 .873129192 | 184.31799 
           |      9.29       2.21       1.29       0.00       0.06 |     12.85 
-----------+-------------------------------------------------------+----------
         3 |  34.52587  11.318771  1.8717049  2.6866272          0 |50.4029729 
           |      2.41       0.79       0.13       0.19       0.00 |      3.51 
-----------+-------------------------------------------------------+----------
         4 | 41.561149  17.938382  10.950547  .30488809  10.321793 |  81.07676 
           |      2.90       1.25       0.76       0.02       0.72 |      5.65 
-----------+-------------------------------------------------------+----------
     Total | 1,276.211  103.55208  37.774608  4.0920385  12.369923 |     1,434 
           |     89.00       7.22       2.63       0.29       0.86 |    100.00 

*/


***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************


/*
16. Two-thirds of teachers (including 50% of those who believe that natural causes drive global 
warming) said they would be interested in continuing education �entirely focused on climate change.� 
*/

tab q16_gwcauses q21_courseclimate_opp [aw=anal_wt], row

/*
                      |   courses entirely
                      |  focused on climate
                      | change: i would take
         which of the | advantage of such an
      following comes |          op
closest to your view? |       yes         no |     Total
----------------------+----------------------+----------
global warming is cau | 591.06023 351.354136 | 942.41437 
                      |     62.72      37.28 |    100.00 
----------------------+----------------------+----------
                  1.5 | 88.735766  74.947368 | 163.68313 
                      |     54.21      45.79 |    100.00 
----------------------+----------------------+----------
global warming is cau |  95.42706  123.53582 | 218.96287 
                      |     43.58      56.42 |    100.00 
----------------------+----------------------+----------
global warming is not | 5.4731428  26.653741 | 32.126884 
                      |     17.04      82.96 |    100.00 
----------------------+----------------------+----------
      other (specify) |.294092258          0 |.294092258 
                      |    100.00       0.00 |    100.00 
----------------------+----------------------+----------
                    5 |  22.49521  13.023436 | 35.518646 
                      |     63.33      36.67 |    100.00 
----------------------+----------------------+----------
                Total |803.485504 589.514496 |     1,393 
                      |     57.68      42.32 |    100.00 

*/


***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************


/*
17. A question measuring political ideology was a more powerful predictor of teachers� 
classroom approach than any measure of education or content knowledge, with those leaning towards �It�s not 
the government�s business to pro-tect people from themselves� most willing to teach �both sides� (table S8).
*/

** Emphasis Scale

** Model
/*
LEE IS FOLLOWING UP ON HOW SOME OF THE CONTROLS WERE CALCULATED. WILL ALSO INCLUDE CODE THAT PRODUCES
THE DEPENDENT VARIABLE

emphasis = biology + earth science + physics + chemistry + middle school + female + yearstaught + knowledge + 
exposure to climate change + priority to foils + selected 81-100 + govrolescale + constant 

N = 1074, R2 = 0.41

*/
* this totals the number of missing answers to the 18 questions.  
* scores of 0-17 indicate that the respondent answered at least one question

* egen nmis=rmiss2(q21*)

** The following assigns a score of zero courses to all questions if the respondent answered
***  at least a single question in the q21 grid 
** VARIABLES CREATED IN ORIGINAL FILE AND REMOVED FROM RELEASE. SEE CODEBOOK AND SURVEY QUESTIONNAIRES
** TO SEE HOW THESE QUESTIONS WERE DERIVED
/*
replace q21_sectionclimate_college = 0 if q21_sectionclimate_college == . & nmis < 18
replace q21_courseclimate_college = 0 if q21_courseclimate_college == . & nmis < 18
replace q21_sectionclimate_conted = 0 if q21_sectionclimate_conted == . & nmis < 18
replace q21_courseclimate_conted = 0 if q21_courseclimate_conted == . & nmis < 18
replace q21_courseclimate_opp = 2 if q21_courseclimate_opp == . & nmis < 18
*/

*** Create dependent variable (Remove NA from analysis of emphasis)
replace q4_naturalcauses = . if q4_naturalcauses == 5
replace q4_sciconsensus = . if q4_sciconsensus == 5 

gen emph_diff = (q4_naturalcauses - q4_sciconsensus)/3



*** Then create initial educational exposure measure in two steps:
** First:
* gen ed_summary = .
* replace ed_summary= (10*q21_courseclimate_college) +q21_sectionclimate_college
tab ed_summary [aw=anal_wt]

/*
 ed_summary |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 | 819.444156       57.14       57.14 None at all (57.14%)
          1 | 247.406014       17.25       74.40 Only one class covered the topic (17.25%)
          2 |133.2741657        9.29       83.69 Two or more courses covered topic (9.29+2.41+2.90 =
          3 |34.52587018        2.41       86.10
          4 | 41.5611492        2.90       89.00
         10 | 5.25002863        0.37       89.36 One course entirely focused on cc (96.67 - 89.0 = 6.67
         11 | 37.3444999        2.60       91.97
         12 | 31.7003946        2.21       94.18
         13 | 11.3187707        0.79       94.97
         14 | 17.9383818        1.25       96.22
         20 | 5.11221371        0.36       96.57  Two or omre courses (100 - 96.22 = 3.8)
         21 |1.369845542        0.10       96.67
         22 | 18.4702964        1.29       97.96
         23 | 1.87170486        0.13       98.09
         24 | 10.9505471        0.76       98.85
         30 | 1.10052325        0.08       98.93
         33 |  2.6866272        0.19       99.12
         34 | .304888091        0.02       99.14
         40 | 1.17500056        0.08       99.22
         42 | .873129192        0.06       99.28
         44 |10.32179345        0.72      100.00
------------+-----------------------------------
      Total |      1,434      100.00

*/
**** Second: Class exposure variables need to be collapsed
*CREATED IN ORIGINAL FILE
/*
gen college_summary=.
replace college_summary = 0 if ed_summary==0
replace college_summary = 1 if ed_summary==1
replace college_summary = 2 if ed_summary>=2 & ed_summary<10
replace college_summary = 3 if ed_summary>=10 & ed_summary<20
replace college_summary = 4 if ed_summary>=20
replace college_summary = . if ed_summary == .

label define course 1 "One exposure"
label define course 2 "Two or more exposures", add
label define course 3 "One entire class", add
label define course 4 "2+ classes", add
label define course 0 "None", add
label values college_summary course
*/

tab college_summary [aw=anal_wt]

/*      college_summary |      Freq.     Percent        Cum.
----------------------+-----------------------------------
                 None | 819.444156       57.14       57.14
         One exposure | 247.406014       17.25       74.40
Two or more exposures | 209.361185       14.60       89.00
     One entire class |103.5520756        7.22       96.22
           2+ classes | 54.2365693        3.78      100.00
----------------------+-----------------------------------
                Total |      1,434      100.00

*/

** foils

replace q8_aerosol = . if q8_aerosol == 5
replace q8_ozone = . if q8_ozone == 5
replace q8_pesticid = . if q8_pesticid == 5
replace q8_rockets = . if q8_rockets == 5

tab1 q8_aerosol q8_ozone q8_pesticid q8_rockets

gen foils01 = ((-1* (q8_aerosol+q8_ozone+q8_pesticid+q8_rockets))+16)/12
tab foils01
sum foils01

alpha q8_aerosol q8_ozone q8_pesticid q8_rockets, std item detail gen(foil_alpha)
sum foil_alpha

gen foil_alpha01 = round((foil_alpha + 2.356893)/5.252563 , .01)
sum foil_alpha01

/*
    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
foil_alpha01 |      1428    .4473179    .1486916          0          1


*/

************** Consensus awareness binary variable  ************
gen consens80 = .
replace consens80 = 1 if q18_humanpct==5
replace consens80 = 0 if q18_humanpct< 5
replace consens80 = 0 if q18_humanpct==6
tab q18_humanpct consens80, missing

/*
 to the best |
     of your |
  knowledge, |
        what |
  proportion |
  of climate |
  scientists |            consens80
 think that  |         0          1          . |     Total
-------------+---------------------------------+----------
     0 - 20% |        27          0          0 |        27 
   21% - 40% |        90          0          0 |        90 
   41% - 60% |       177          0          0 |       177 
   61% - 80% |       299          0          0 |       299 
  81% - 100% |         0        583          0 |       583 
i don't know |       293          0          0 |       293 
           . |         0          0         31 |        31 
-------------+---------------------------------+----------
       Total |       886        583         31 |     1,500 

*/  

***** Government role scale (-1 to +1) *****
*recoding govrole to -1 to +1
gen govrole = (q19_govrole-4)/3
tab govrole
/*
    govrole |      Freq.     Percent        Cum.
------------+-----------------------------------
         -1 |         52        3.55        3.55
  -.6666667 |         64        4.37        7.92
  -.3333333 |        105        7.17       15.09
          0 |        260       17.75       32.83
   .3333333 |        372       25.39       58.23
   .6666667 |        380       25.94       84.16
          1 |        232       15.84      100.00
------------+-----------------------------------
      Total |      1,465      100.00
*/

gen female = 0
replace female = 1 if q27_gender == 2 

* Then estimate the model
reg emph_diff i.subject  female q25_yrsteach i.college_summary i.q23_climate foil_alpha01 consens80 govrole [pw=nonres_wt]

/*

Linear regression                                      Number of obs =    1052
                                                       F( 16,  1035) =   51.07
                                                       Prob > F      =  0.0000
                                                       R-squared     =  0.4095
                                                       Root MSE      =  .34338

------------------------------------------------------------------------------------------------------------
                                           |               Robust
                                emph_diff2 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------------------------------------+----------------------------------------------------------------
                                   subject |
                            earth science  |  -.0963641   .0326876    -2.95   0.003    -.1605058   -.0322225
                                  physics  |  -.0384377   .0460017    -0.84   0.404    -.1287049    .0518294
                                chemistry  |  -.1081083    .041919    -2.58   0.010    -.1903643   -.0258523
                            middle school  |  -.0592277   .0293544    -2.02   0.044    -.1168286   -.0016267
                                           |
                                    female |   .0477783   .0227747     2.10   0.036     .0030885    .0924681
                              q25_yrsteach |  -.0031244   .0011515    -2.71   0.007     -.005384   -.0008648
                                           |
                           college_summary |
                             One exposure  |   .0269637   .0306212     0.88   0.379     -.033123    .0870503
                    Two or more exposures  |   .0090471   .0296897     0.30   0.761    -.0492118    .0673059
                         One entire class  |   .0124912   .0459456     0.27   0.786    -.0776659    .1026483
                               2+ classes  |  -.0362972   .0458589    -0.79   0.429    -.1262842    .0536897
                                           |
                               q23_climate |
     typical of most high school teachers  |   .0176235   .0344288     0.51   0.609    -.0499347    .0851816
very good compared to most high school ..  |   .0726909   .0405315     1.79   0.073    -.0068425    .1522242
exceptional: on par with many college-l..  |   .1289623   .0807127     1.60   0.110     -.029417    .2873415
                                           |
                              foil_alpha01 |   .0880711   .0750663     1.17   0.241    -.0592283    .2353706
                                 consens80 |   .3202919   .0262151    12.22   0.000      .268851    .3717328
                                   govrole |   .3370012   .0258398    13.04   0.000     .2862969    .3877055
                                     _cons |   .0379788   .0540817     0.70   0.483    -.0681436    .1441011
------------------------------------------------------------------------------------------------------------

. 

*/



